﻿(function () {
    var dev = false, //上线时，修改为false
       scripts = document.scripts,
       script = scripts[scripts.length - 1],
       boot = script.getAttribute('data-init'),
       dir = script.getAttribute('src');

    dir = dir.slice(0, dir.lastIndexOf('/') + 1) + (dev ? 'src/' : 'dist/');
    window.front_url = dir.slice(0, dir.indexOf('/', 8) + 1);
    seajs.config({
        'base': window.front_url,
        'alias': {
            'domains': 'ssxt/model/domains/dist/domains.js',
            'public': 'ssxt/nygxw2.0/public/dist/public.js',
            'jquery': 'ssxt/model/lib/jquery/seajs-jquery-1.8.3.min.js',
            'forimg': 'ssxt/model/forimg/dist/forimg.js'
        },
        'map': [
           [/^(.*\.(?:css|js))(.*)$/i, '$1?t=2015032701']
        ]
    });
    //dev 
    //if (dev) {
    //    dir = dir + 'src/';
    //} else {
    //    dir = dir + 'dist/';
    //}
    /*
     * 上面获取路径脚本需要立刻执行
     * 将加载脚本放到domReady后执行，避免ie浏览器终止操作错误
     */
    seajs.use('jquery', function ($) {        
        $(function () {
            seajs.use('public');
            if (boot) {
                seajs.use(dir + boot);
            }
        });
    });
})();
